/**
 * @file
 * @brief 玄武OS内核操作系统接口描述层：线程栅栏
 * @author
 * + 隐星魂 (Roy Sun) <xwos@xwos.tech>
 * @copyright
 * + Copyright © 2015 xwos.tech, All Rights Reserved.
 * > This Source Code Form is subject to the terms of the Mozilla Public
 * > License, v. 2.0 (the "MPL"). If a copy of the MPL was not distributed
 * > with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * >
 * > Alternatively, the contents of this file may be used under the
 * > terms of the GNU General Public License version 2 (the "GPL"), in
 * > which case the provisions of the GPL are applicable instead of the
 * > above. If you wish to allow the use of your version of this file
 * > only under the terms of the GPL and not to allow others to use your
 * > version of this file under the MPL, indicate your decision by
 * > deleting the provisions above and replace them with the notice and
 * > other provisions required by the GPL. If you do not delete the
 * > provisions above, a recipient may use your version of this file
 * > under either the MPL or the GPL.
 */

#ifndef __xwos_mp_osdl_sync_br_h__
#define __xwos_mp_osdl_sync_br_h__

#include <xwos/mp/osdl/sync/sel.h>
#include <xwos/mp/sync/evt.h>

#define xwosdl_br xwmp_evt

static __xwcc_inline
xwer_t xwosdl_br_init(struct xwosdl_br * br, xwsz_t num,
                      xwbmp_t * bmp, xwbmp_t * msk)
{
        return xwmp_evt_init(br, XWMP_EVT_TYPE_BR, num, bmp, msk);
}

static __xwcc_inline
xwer_t xwosdl_br_fini(struct xwosdl_br * br)
{
        return xwmp_evt_fini(br);
}

static __xwcc_inline
xwer_t xwosdl_br_create(struct xwosdl_br ** brbuf, xwsz_t num)
{
        return xwmp_evt_create(brbuf, XWMP_EVT_TYPE_BR, num);
}

static __xwcc_inline
xwer_t xwosdl_br_delete(struct xwosdl_br * br)
{
        return xwmp_evt_delete(br);
}

static __xwcc_inline
xwsq_t xwosdl_br_gettik(struct xwosdl_br * br)
{
        return xwmp_evt_gettik(br);
}

static __xwcc_inline
xwer_t xwosdl_br_acquire(struct xwosdl_br * br, xwsq_t tik)
{
        return xwmp_evt_acquire(br, tik);
}

static __xwcc_inline
xwer_t xwosdl_br_release(struct xwosdl_br * br, xwsq_t tik)
{
        return xwmp_evt_release(br, tik);
}

static __xwcc_inline
xwer_t xwosdl_br_grab(struct xwosdl_br * br)
{
        return xwmp_evt_grab(br);
}

static __xwcc_inline
xwer_t xwosdl_br_put(struct xwosdl_br * br)
{
        return xwmp_evt_put(br);
}

static __xwcc_inline
xwer_t xwosdl_br_bind(struct xwosdl_br * br, struct xwosdl_sel * sel, xwsq_t pos)
{
        return xwmp_evt_bind(br, sel, pos);
}

static __xwcc_inline
xwer_t xwosdl_br_unbind(struct xwosdl_br * br, struct xwosdl_sel * sel)
{
        return xwmp_evt_unbind(br, sel);
}

static __xwcc_inline
xwer_t xwosdl_br_intr_all(struct xwosdl_br * br)
{
        return xwmp_evt_intr_all(br);
}

static __xwcc_inline
xwer_t xwosdl_br_get_num(struct xwosdl_br * br, xwsz_t * numbuf)
{
        return xwmp_evt_get_num(br, numbuf);
}

static __xwcc_inline
xwer_t xwosdl_br_wait(struct xwosdl_br * br)
{
        return xwmp_br_wait(br);
}

static __xwcc_inline
xwer_t xwosdl_br_timedwait(struct xwosdl_br * br, xwtm_t * xwtm)
{
        return xwmp_br_timedwait(br, xwtm);
}

#endif /* xwos/mp/osdl/sync/br.h */
